document.querySelectorAll('.download-btn').forEach(button => {
    button.addEventListener('click', function() {
        const listItem = this.closest('li');
        const fileName = listItem.dataset.file;
        const fileUrl = `https://api.yoursite.com/download/${fileName}`; // 替换为实际下载接口
        
        // 动态创建下载链接
        const link = document.createElement('a');
        link.href = fileUrl;
        link.download = fileName;
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        
        // 添加下载动画反馈
        this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 下载中...';
        setTimeout(() => {
            this.innerHTML = '<i class="fas fa-check"></i> 完成';
        }, 1500);
    });
});



const navContainer = document.querySelector('.nav-container');  
const navButtons = document.querySelector('.nav-buttons');  
let hoverTimer;  

// 桌面端悬停控制  
navContainer.addEventListener('mouseenter', () => {  
  if (window.innerWidth > 768) {  
    clearTimeout(hoverTimer);  
    navButtons.style.display = 'flex';  
  }  
});  

navContainer.addEventListener('mouseleave', () => {  
  if (window.innerWidth > 768) {  
    hoverTimer = setTimeout(() => {  
      navButtons.style.display = 'none';  
    }, 200); // 200ms 延迟防误触  
  }  
});  

// 移动端自动关闭  
window.addEventListener('resize', () => {  
  if (window.innerWidth <= 768) {  
    navButtons.style.display = 'none';  
  }  
});